package com.campusbackend.controller;

import com.campusbackend.entity.Result;
import com.campusbackend.entity.Skills;
import com.campusbackend.service.SkillsService;
import com.campusbackend.utils.ResultUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 技能特长字典表 前端控制器
 * </p>
 *
 * @author yezi
 * @since 2025-07-24
 */
@Slf4j
@RestController
@RequestMapping("/skills")
public class SkillsController {

    @Autowired
    private SkillsService skillsService;

    /**
     * 获取所有可用的技能列表
     * @return 技能列表
     */
    @GetMapping("/list")
    public Result<List<Skills>> getAllActiveSkills() {
        log.info("获取技能列表请求");
        
        try {
            List<Skills> skills = skillsService.getAllActiveSkills();
            return ResultUtil.success(skills);
        } catch (Exception e) {
            log.error("获取技能列表异常", e);
            return ResultUtil.fail("获取技能列表时发生错误");
        }
    }
}
